%This file creates two cluster, with a small cluster that 
%will overlap them
%two dimentional

cluster_distance = 2;
cluster_radius = 5;
cluster_size = 40;
small_cluster_size = 15;

C1 = create_cluster([-cluster_radius/2 - cluster_distance/2, 0]', [1,1]', cluster_size);
C2 = create_cluster([cluster_radius/2 + cluster_distance/2, 0]', [1,1]', cluster_size);
%noise cluster:
C3 = create_cluster([0,0]', [cluster_distance, 1]', small_cluster_size);

C = [C1, C2, C3];
my_ones = ones(1, cluster_size);
colors = [my_ones, my_ones*3, ones(1,small_cluster_size)*2];

figure;
scatter(C(1,:), C(2,:),[],colors','filled');
axis equal;
title('Generated Data')

%K-means
figure;
class = kmeans(C', 2);
scatter(C(1,:), C(2,:),[], class', 'filled');
axis equal;
title('K-Means results');

%Hierarchical, with NN
figure;
class = clusterdata(C', 'maxclust', 2, 'linkage', 'single');
scatter(C(1,:), C(2,:), [], class', 'filled');
axis equal;
title('hierarchical NN results');

%Hierarchical, with FN
figure;
class = clusterdata(C', 'maxclust', 2, 'linkage', 'complete');
scatter(C(1,:), C(2,:), [], class', 'filled');
axis equal;
title('hierarchical FN results');

%Results - NN sux, FN rulez, K-means = OK.

